/*
 *	spectrogram.h
 *
 *	sglib.lib
 *
 *	Audio Finger Print project
 */

#ifndef __SPECTROGRAM_H__
#define __SPECTROGRAM_H__

#ifdef __cplusplus
extern "C" {
#endif

#define	SG_FFT_SIZE         512
#define	SG_FFT_SIZE2        (SG_FFT_SIZE/2)
#define	SG_WINDOW_OVERLAP   8
#define SG_INOUT_SIZE       (SG_FFT_SIZE/SG_WINDOW_OVERLAP)
#define SG_MAX 4

typedef struct
{
	// temporal memory
	float mSpectrogram[SG_FFT_SIZE2];

	float powerAbsPeak;

	float mRe[SG_MAX];
	float mIm[SG_MAX];

	// output parameters
	union
	{
		unsigned __int8 mBin[SG_MAX];
		__int32 mHash;
	};

}	SPECTROGRAM;

typedef union
{
	unsigned __int8 mBin[SG_MAX];
	__int32 mHash;
}	BINHASH;

void resetSpectrogram(SPECTROGRAM* data);
void runSpectrogram(SPECTROGRAM* data, float* bufProc);

void SG_ProcessFile(char* name);
int SG_Search(const __int32* bufSubstring, const __int64 sizeSubstring);

#ifdef __cplusplus
};
#endif

#endif // __SPECTROGRAM_H__
